cmake_minimum_required(VERSION 3.10)
project(occ_hello_world)

# 设置C++标准
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 查找OpenCASCADE包
find_package(OpenCASCADE REQUIRED)

find_package(VTK REQUIRED COMPONENTS
  CommonCore
  CommonDataModel
  FiltersCore
  InteractionStyle
  RenderingCore
  RenderingOpenGL2
  RenderingContextOpenGL2
  RenderingOpenGL2
  InteractionWidgets)

# 添加可执行文件
add_executable(occ_hello_world main.cpp)

# message(STATUS "TKIVtkTools_FOUND: ${TKIVtkTools_FOUND}")

# 链接OpenCASCADE库
target_link_libraries(occ_hello_world TKernel TKMath TKGeomBase TKGeomAlgo TKTopAlgo TKPrim TKShHealing TKMesh TKMeshVS TKService TKIVtk TKDESTEP ${VTK_LIBRARIES})
vtk_module_autoinit(TARGETS occ_hello_world MODULES ${VTK_LIBRARIES})


include(InstallRequiredSystemLibraries)
install(TARGETS occ_hello_world
    BUNDLE DESTINATION .
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

install(
    TARGETS occ_hello_world
    RUNTIME_DEPENDENCIES
        DIRECTORIES $<TARGET_FILE_DIR:VTK::CommonCore>;$<TARGET_FILE_DIR:TKernel>
        PRE_EXCLUDE_REGEXES "api-ms-" "ext-ms-"  # don't install Windows-provided libs
        POST_EXCLUDE_REGEXES ".*system32/.*\\.dll"  # don't install Windows-provided libs
)